package test

import (
	"math/rand"
	"strconv"
	"sync"
	"time"
)

type TestService struct {
}

var testService *TestService
var onceTestService sync.Once

func GetTestService() *TestService {
	onceTestService.Do(func() {
		testService = &TestService{}
	})
	return testService
}

func (s *TestService) GetRandomData() map[string]any {
	data := map[string]any{
		"id":     rand.Intn(1000),
		"name":   "User" + strconv.Itoa(rand.Intn(100)),
		"active": rand.Intn(2) == 1,
		"metadata": map[string]any{
			"createdAt": time.Now().Add(-time.Duration(rand.Intn(72)) * time.Hour),
			"tags":      []string{"A", "B", "C"}[rand.Intn(3) : rand.Intn(3)+1],
		},
	}
	return data
}
